﻿using System.Windows.Controls;
using StoryDesigner.Controls;
using StoryDesigner.Webservices;

namespace StoryDesigner
{
	public partial class StoryWorkspace : UserControl
	{
		public StoryWorkspace()
		{
			InitializeComponent();
			UiManager.Initialize(_cnvWorkSpace);
		}

		public void Refresh()
		{
			if (DataContext == null)
				return;
			if (!(DataContext is StoryArc))
				return;
			UiManager.Instance.Clear();
			StoryArc arc = DataContext as StoryArc;
			StoryArcControl arcControl = new StoryArcControl {DataContext = arc};
			UiManager.Instance.AddElement(arcControl);

			//if(arc.StartingTask != null)
			//{
			//    StoryTaskControl task = new StoryTaskControl {DataContext = arc.StartingTask};
			//    UiManager.Instance.AddElement(task);
			//}
		}
	}
}
